package com.czxy.changgou3.com.czxy.changgou3.controller;

import com.czxy.changgou3.com.czxy.changgou3.service.SkuCommentService;
import com.czxy.changgou3.pojo.PageRequest;
import com.czxy.changgou3.vo.CommentResult;
import com.czxy.vo.BaseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by liangtong.
 */
@RestController
@RequestMapping("/comments")
public class SkuCommentController {

    @Resource
    private SkuCommentService skuCommentService;

    @GetMapping("/spu/{spuId}")
    public BaseResult findComments(@PathVariable("spuId") Integer spuId, PageRequest pageRequest){
        //1 查询
        CommentResult commentResult = skuCommentService.findComments(spuId, pageRequest);

        //2 返回
        return BaseResult.ok("查询成功", commentResult);
    }


}
